<?php
// $Id$

/**
 * Controller_Admin_User 控制器
 */
class Controller_Admin_Article extends Controller_Abstract
{

	function actionIndex()
	{
		$articles = Article::find()->setColumns('article_id, title')->getAll();
		$this->_view['articles'] = $articles;
	}
	
	function actionEdit()
	{
		$article = Article::find('article_id = ?', $this->_context->aid)->getOne();
		$this->_view['article'] = $article;
	}
	
	function actionSave()
	{
		$aid = $this->_context->article_id;
		$article = Article::find('article_id = ?', $aid)->forUpdate()->getOne();
		$article->changeProps($_POST);
		$article->save();
		
		return $this->_redirect(url('/edit', array('aid' => $article->id())));
		
	}
	
	
}